// Copyright DustedPixels.com 2008. All rights reserved.

package kroff;

import com.dustedpixels.common.base.Repeatable;

/**
 * @author micapolos@gmail.com (Michal Pociecha-Los)
 */
public final class Repeatables {
  public static Repeatable over(final Runnable runnable) {
    return new Repeatable() {
      public void repeat(int times) {
        if (times < 0) throw new IllegalArgumentException("Negative times.");
        while (times-- != 0) {
          runnable.run();
        }
      }
    };
  }
}
